#ifndef TINKERCELL3D_MAYA_PLUGIN
#define TINKERCELL3D_MAYA_PLUGIN

#include "GlobalSettings.h"
#include "Ontology.h"
#include "BasicInformationTool.h"
#include "StoichiometryTool.h"
#include "FunctionDeclarationsTool.h"
#include "ModelSummaryTool.h"
#include "ContainerTool.h"
#include "ModelFileGenerator.h"
#include "SimulationEventTool.h"
#include "ModuleTool.h"
#include "WetLabTool.h"
#include "AutoGeneRegulatoryTool.h"
#include "DNASequenceTool.h"
#include "ViewTablesTool.h"
#include "LPSolveInput.h"
#include "CellPositionUpdatingTool.h"
#include "OctaveExporter.h"
#include "EnglishExporter.h"
#include "AntimonyEditor.h"
#include "SBMLImportExport.h"
#include "CopasiExporter.h"
#include "TinkerCellAboutBox.h"
#include "CollisionDetection.h"
#include "ConnectionInsertion.h"
#include "ConnectionMaker.h"
#include "NodeInsertion.h"
#include "GraphicsReplaceTool.h"
#include "GraphicsTransformTool.h"
#include "GroupHandlerTool.h"
#include "NameFamilyDialog.h"
#include "ConnectionSelection.h"
#include "NodeSelection.h"
#include "GraphicsScene.h"
#include "ConsoleWindow.h"
#include "GraphicsScene.h"
#include "NodeGraphicsItem.h"
#include "sbml_sim.h"
#include <maya/MArgList.h>
#include <maya/MPoint.h>
#include <maya/MTemplateCommand.h>
#include <maya/MMessage.h>
#include <maya/MGlobal.h>
#include <maya/MTime.h>
#include <maya/MDGMessage.h>
#include <maya/MDoubleArray.h>
#include <maya/MpxCommand.h>
#include <maya/MSelectionList.h>
#include <maya/MnParticle.h>
#include <maya/MnSolver.h>
#include <maya/MMatrix.h>
#include <maya/MFloatPointArray.h>

#if defined(WIN32) || defined(WIN64)
#    define NTINKEREXPORT _declspec( dllexport )
#endif

namespace nTinker 
{
	struct Centroid
	{
		MDoubleArray values;
		MPoint pos;
	};

	void updateCountsPy();

	void updateEmittersPy();

	double valueDistance(const Centroid&, const Centroid&);

	double posDistance(const Centroid&, const Centroid&);

	char SimulateCmdName[] = "simulate";
	char SetParamCmdName[] = "setParam";
	char ComputeDensityCmdName[] = "computeParticleDensity";
	
	class NTINKEREXPORT SetParamCmd : public MTemplateAction<SetParamCmd,  SetParamCmdName , MTemplateCommand_nullSyntax >
	{
	public:
		MStatus doIt(const MArgList&);
	private:
		static QHash<QString, int> nameToIndex;
		static std::vector<double> paramValues;
	};

	class NTINKEREXPORT SimulateCmd : public MTemplateAction<SimulateCmd, SimulateCmdName, MTemplateCommand_nullSyntax >
	{
	public:
		MStatus doIt(const MArgList& );
	private:
		static std::vector<double> varValues;
	};

	class NTINKEREXPORT ComputeDensityCmd : public MTemplateAction<ComputeDensityCmd, ComputeDensityCmdName, MTemplateCommand_nullSyntax >
	{
	public:
		MStatus doIt(const MArgList& );
	};


	class NTINKEREXPORT Animator : public QObject
	{
			Q_OBJECT
	public:
		static Animator * load();
		static void unload();
		Animator(QObject * parent);
	
	public slots:
		void animate();

	public:
		static Tinkercell::MainWindow * mainWindow;
		static Tinkercell::Plot2DWidget * plotWidget;
		static Tinkercell::SBMLImportExport * sbmlTool;
		static SBML_sim * simulator;

	private:
		static QWidget * widget;
		void createParticlesAt(MString name, MPoint, QColor);
		void createParticlesFromCells();
	};
}

#endif
